const { defineConfig } = require('@vue/cli-service')
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: process.env.BASE_URL,
  devServer: {
    proxy: {
      '^/dii': {
        target: process.env.VUE_APP_PROXY_TARGET,
        changeOrigin: true,
        ws: false,
        pathRewrite: {
          '^/dii': '',
        },
      },
    },
    client: {
      overlay: false,
    }
  },
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '首页'
        return args
      })
  },
  configureWebpack: {
    plugins: [
      new CopyWebpackPlugin({
        patterns: [
          { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/crossdomain.xml'},
          { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/liveplayer.swf'},
          { from: 'node_modules/@liveqing/liveplayer-v3/dist/component/liveplayer-lib.min.js', to: 'js/' },
        ]
      })
    ]
  }

})